#!/usr/bin/env python3
import subprocess
import os

os.chdir('/Users/mac/git/stata')

# 查看未跟踪的文件
print("=== 未跟踪的文件 (Untracked) ===")
result = subprocess.run(['git', 'ls-files', '--others', '--exclude-standard'], 
                       capture_output=True, text=True)
untracked = result.stdout.strip().split('\n') if result.stdout.strip() else []
for f in untracked:
    print(f"  {f}")

print(f"\n总计: {len(untracked)} 个未跟踪文件")

# 查看已修改但未暂存的文件
print("\n=== 已修改但未暂存的文件 (Modified) ===")
result2 = subprocess.run(['git', 'diff', '--name-only'], 
                        capture_output=True, text=True)
modified = result2.stdout.strip().split('\n') if result2.stdout.strip() else []
for f in modified:
    if f:
        print(f"  {f}")

print(f"\n总计: {len([f for f in modified if f])} 个已修改文件")

# 查看已暂存但未提交的文件
print("\n=== 已暂存但未提交的文件 (Staged) ===")
result3 = subprocess.run(['git', 'diff', '--cached', '--name-only'], 
                        capture_output=True, text=True)
staged = result3.stdout.strip().split('\n') if result3.stdout.strip() else []
for f in staged:
    if f:
        print(f"  {f}")

print(f"\n总计: {len([f for f in staged if f])} 个已暂存文件")

# 总结
print("\n" + "="*50)
total_uncommitted = len(untracked) + len([f for f in modified if f]) + len([f for f in staged if f])
print(f"未提交文件总数: {total_uncommitted}")

